import request from '@/utils/request'

// 获取注册验证码
const getRegisterCode = (phone) => {
  return request({
    url: `/api/user/passport/sendCode/${phone}`
  })
}

// 注册
const goRegister = (data) => {
  return request({
    url: '/api/user/passport/register',
    method: 'post',
    data
  })
}

// 登录
const toLogin = (data) => {
  return request({ 
    url: '/api/user/passport/login', 
    data, 
    method: 'post' })
}

// 获取用户信息【需要带着用户的token向服务器要用户信息】
// URL:/api/user/passport/auth/getUserInfo  method:get
const reqUserInfo = () => {
  return request({ url: '/api/user/passport/auth/getUserInfo', method: 'get' })
}

// 退出登录
const reqLogout = () => request({ url: '/api/user/passport/logout', method: 'get' })

export { getRegisterCode, goRegister, toLogin, reqUserInfo, reqLogout }
